package com.vainycos.lotterysearch.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.vainycos.lotterysearch.model.DoubleColorBall;
import org.apache.ibatis.annotations.Select;

/**
 * @author: Vainycos
 * @description
 * @date: 2022/11/10 14:19
 */
public interface DoubleColorBallMapper extends BaseMapper<DoubleColorBall> {

    @Select("SELECT\n" +
            "concat\n" +
            "(\n" +
            "truncate(\n" +
            "((SELECT count(1) as count FROM `double_color_ball` WHERE (red_ball_one=#{frontAreaNum} or red_ball_two=#{frontAreaNum} or red_ball_three=#{frontAreaNum} or red_ball_four=#{frontAreaNum} or red_ball_five=#{frontAreaNum} or red_ball_six=#{frontAreaNum}))/(SELECT count(1) as count FROM `big_lottery_ball`))*100, 2\n" +
            "), '%'\n" +
            ")")
    String historyFrontArea(int frontAreaNum);

    @Select("SELECT\n" +
            "concat\n" +
            "(\n" +
            "truncate(\n" +
            "((SELECT count(1) as count FROM `double_color_ball` WHERE (blue_ball_one=#{endAreaNum}))/(SELECT count(1) as count FROM `big_lottery_ball`))*100, 2\n" +
            "), '%'\n" +
            ")")
    String historyEndArea(int endAreaNum);
}
